﻿@model MvcUI.Models.ListRoleViewModel
@{
    Layout = null;
}
<script language="javascript" type="text/javascript">
    function MyOwnFunction(json) {
        DWZ.ajaxDone(json);
        if (json.statusCode == DWZ.statusCode.ok) {
           
            dialogPageBreak();
            navTabPageBreak({ pageNum: "1", numPerPage: "20", orderField: "Name", orderDirection: "asc" }, "jbsxBox3")
            if ("closeCurrent" == json.callbackType) {
                setTimeout(function () { $.pdialog.closeCurrent(); }, 100);
            } else if ("forward" == json.callbackType) {
                dialog.reload(json.forwardUrl);
            }
        }
    }
  
</script>
<div class="pageHeader" style="border: 1px #B8D0D6 solid">
    @using (Html.BeginForm("AddRoles", "MUserRole", FormMethod.Post, new { id = "pagerForm", onsubmit = "return dwzSearch(this, 'dialog');" }))
    {
        <input type="hidden" name="pageNum" value="@Model.PagingInfo.CurrentPage" />
        <input type="hidden" name="numPerPage" value="@Model.PagingInfo.ItemsPerPage" />
        <input type="hidden" name="orderField" value="@Model.PagingInfo.OrderField" />
        <input type="hidden" name="orderDirection" value="@Model.PagingInfo.OrderDirection" />
    }
    <div class="pageHeader">
        @using (Html.BeginForm("AddRoles", "MUserRole", FormMethod.Post, new { rel = "pagerForm", onsubmit = "return dwzSearch(this, 'dialog');" }))
        {
            <div class="searchBar">
                <table class="searchContent">
                    <tr>
                        <td>
                            <label>
                                角色名：</label>
                            <input type="text" name="keywords" value="@Model.KeyWord" />
                        </td>
                        <td>
                            <div class="buttonActive">
                                <div class="buttonContent">
                                    <button type="submit">
                                        检索</button></div>
                            </div>
                        </td>
                    </tr>
                </table>
            </div>
        }
    </div>
</div>
<div class="pageContent" style="border-left: 1px #B8D0D6 solid; border-right: 1px #B8D0D6 solid">
    <table class="table" layouth="135" targettype="dialog">
        <thead>
            <tr>
                <th>
                    <input type="checkbox" group="ids" class="checkboxCtrl">
                </th>
                <th width="90" orderfield="Name" class="@Model.PagingInfo.OrderDirection">
                    角色名称
                </th>
                <th width="150">
                    描述
                </th>
                <th width="70">
                    是否可用
                </th>
                <th width="150">
                    备注
                </th>
            </tr>
        </thead>
        <tbody>
            @foreach (var s in Model.Roles)
            { 
                <tr target="sid_user" rel="@s.ID">
                    <td>
                        <input name="ids" value="@s.ID" type="checkbox">
                    </td>
                    <td>@s.Name
                    </td>
                    <td>@s.Description
                    </td>
                    <td>@s.Enabled
                    </td>
                    <td>@s.Remark
                    </td>
                </tr>
            }
        </tbody>
    </table>
    <div class="panelBar">
        <div class="pages">
            <span>每页显示</span>
            <select class="combox" name="numPerPage" onchange="dwzPageBreak({targetType:dialog, numPerPage:'10'})">
                <option value="20">20</option>
                <option value="50">50</option>
                <option value="100">100</option>
                <option value="200">200</option>
            </select>
            <span>条，共
                @Model.PagingInfo.TotalItems
                条</span>
        </div>
        <div class="pagination" targettype="dialog" totalcount="@Model.PagingInfo.TotalItems" numperpage="@Model.PagingInfo.ItemsPerPage" pagenumshown="8"
            currentpage="@Model.PagingInfo.CurrentPage">
        </div>
    </div>
    <div class="formBar">
        <ul>
            <li>
                <div class="buttonActive">
                    <div class="buttonContent">
                     <a title="添加角色" target="selectedTodo" targettype="dialog"  rel="ids" href="@Url.Action("Add", "MUserRole")"  callback="MyOwnFunction">
                        <button type="submit" id="AddRoles" >
                            添加</button></a></div>
                </div>
            </li>
            <li>
                <div class="button">
                    <div class="buttonContent">
                        <button type="button" class="close">
                            取消</button></div>
                </div>
            </li>
        </ul>
    </div>
</div>
